-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor code cleanup #1079
Minor code cleanup #1079
Conversation
Made some readability changes and moved the resolved/reject handling code into functions outside of the Deferred constructor
I think I fixed it now, should be good to test |
$promise = coroutine([$handler, 'handle'], $data->d); | ||
$promise->done([$deferred, 'resolve'], [$deferred, 'reject']); | ||
$promise->done(&$onResolve, &$onReject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$promise->done(&$onResolve, &$onReject); | |
$promise->done($onResolve, $onReject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&$deferred was previously passed by reference, and these functions replace deferred
/** @var ExtendedPromiseInterface */ | ||
|
||
if (! $this->emittedInit && ! in_array($data->t, $parse)) { | ||
$this->unparsedPackets[] = function () use (&$handler, &$onResolve, &$onReject, &$data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you passing these as reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&$deferred was previously passed by reference, and these functions replace deferred
Closing this for now due to being outdated by almost two years. A lot has changed with Promises v3 and I'd feel more comfortable remaking this PR from scratch than trying to update it now. |
Made some readability changes and moved the resolved/reject handling code into functions outside of the Deferred constructor, and used === instead of ==